import http from 'libs/http';

//教师登陆
export const teacherLogin = (data, success, error) => {
  const url = '/teacher/login';
  // http.post({ url, data, success, error });
  http.post(url, data).then(success).catch(error)
}

// 教师登陆图形验证码
export const getTeaLoginValidCode = success => {
  const url = '/teacher/getLoginValidCode';
  http.get(url).then(success)
}

// 教师注册图形验证码
export const getTeaRegValidCode = success => {
  const url = '/teacher/getRegisterValidCode';
  http.get(url).then(success)
}

// 获取邮箱验证码
export const getEmailValidCode = (data, success, error) => {
  const url = '/teacher/sendEmailCode'
  http.post(url, data).then(success).catch(error)
}

// 获取国籍列表
export const getCountryList = success => {
  const url = '/teacher/business/getCountryList'
  http.get(url).then(success)
}

// 教师注册
export const teacherRegistry = (data, success, error) => {
  const url = '/teacher/register'
  const showErrorNotice = true
  http.post(url, data, {}, showErrorNotice).then(success).catch(error)
}

// 教师->获取图片验证码
export const getForgetValidCode = success => {
  const url = '/teacher/getForgetValidCode';
  http.get(url).then(success)
}

export const getForgetEmailValidCode = (data, success, error) => {
  const url = '/teacher/sendForgetPasswordEmailCode';
  http.post(url, data).then(success).catch(error)
}

export const saveNewPassword = (data, success) => {
  const url = '/teacher/saveNewPassword';
  const showErrorNotice = true
  http.post(url, data, {}, showErrorNotice).then(success).catch(error)
}

export const teacherLogout = success => {
  const url = '/teacher/logOut'
  http.post(url).then(success)
}